package com.gitee.sidihuo.utils.exception;


import com.gitee.sidihuo.utils.base.IResponseCodeMsg;

public class BizException extends BaseRuntimeException {

    private Integer code;

    private IResponseCodeMsg responseCodeMsg;

    public BizException(IResponseCodeMsg responseCodeMsg, String developMsg, Throwable cause) {
        super(responseCodeMsg.getMessage(), cause);
        this.code = responseCodeMsg.getCode();
        this.responseCodeMsg = responseCodeMsg;
        this.developMsg = developMsg;
    }

    public BizException(IResponseCodeMsg responseCodeMsg, String developMsg) {
        super(responseCodeMsg.getMessage());
        this.code = responseCodeMsg.getCode();
        this.responseCodeMsg = responseCodeMsg;
        this.developMsg = developMsg;
    }

    public Integer getCode() {
        return code;
    }

    public IResponseCodeMsg getResponseCodeMsg() {
        return responseCodeMsg;
    }

    @Override
    public String toString() {
        return "BizException code = " + code + " message = " + this.getMessage() + " developMsg = " + developMsg;
    }

}
